﻿using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Text;
using System.Threading.Tasks;


namespace Domain
{
    public class Translator
    {
        private Evaluator evaluator;
        private Executor executor;

        public Translator()
        {
            evaluator = new Evaluator();
            executor = new Executor();
        }
        public string Translate(string program)
        {
            var nodes = Grammar.Program.Parse(program);
            evaluator.builder.Clear();
            evaluator.blockBuilder.Clear();
            return evaluator.Evaluate(nodes[0]);
        }

        public Dictionary<OutputStrings, string> Execute(Dictionary<InputStrings, string> input)
        {
            var result = executor.Execute(input);
            return result;
        }

    }
    public enum InputStrings
    {
        expresion,
        args
    }

    public enum OutputStrings
    {
        result,
        log
    }
}
